<?php 

class IndexAction extends BaseAction{


	/**
	 * 首页
	 * @return [type] [description]
	 */
	function index(){
		$this->display();
	}

	/**
	 * 列表页
	 * @return [type] [description]
	 */
	function alist(){
		$cid = I('cid');
		$now_cate = M('category')->where(['id'=>$cid])->find();
		$content = M('content')->where(['pid'=>$cid])->select();
		$this->assign('list',$content);
		$this->assign('now_cate',$now_cate);
		$this->display();
	}

	/**
	 * 详情页
	 * @return [type] [description]
	 */
	function detail(){
		$id = I('id');
		$content = M('content')->where(['id'=>$id])->find();
		$this->assign('info',$content);
		$this->display();
	}

	/**
	 * 联系我们
	 * @return [type] [description]
	 */
	function contact(){
		$this->display();
	}

	/**
	 * 简介
	 * @return [type] [description]
	 */
	function catalog(){
		$map['pid'] = 53;   //news
		$id = I('id');
		if($id){
			$maps['pid'] = $id;
		}else{
			$maps['path'] = array('like','0,53%');
		}
		$count  = M('content')->where($maps)->count();// 查询满足要求的总记录数
		import('ORG.Util.Page');// 导入分页类
		$Page   = new Page($count,8);// 实例化分页类 传入总记录数和每页显示的记录数(25)
		$show   = $Page->show();// 分页显示输出
		$list = M("content")->order(array("orderid"=>"asc"))->where($maps)->limit($Page->firstRow.','.$Page->listRows)->select();
		$cate = M("category")->where($map)->select();
		$this->assign("list",$list);
		$this->assign("cate",$cate);
		$this->assign('page',$show);// 赋值分页输出
		$this->display();
	}

}

?>